package cn.wbnull.springbootdemo.io;

import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;

/**
 * 功能描述
 *
 * @author EDZ
 * @since 2022-09-01
 */
class OutInputStream {
    public static void main(String[] args) throws IOException {
/*
        outputStream.write(72);
        outputStream.write(101);
        outputStream.write(108);
        outputStream.write(108);
        outputStream.write(111);
        outputStream.close();
        System.out.println(outputStream.getChannel());*/
//        try (FileOutputStream outputStream= new FileOutputStream("E:/out/readme.txt")){
//            outputStream.write("hell".getBytes(StandardCharsets.UTF_8));

//        }
        byte[] date;
        try (final ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream())
        {
            arrayOutputStream.write("hello".getBytes(StandardCharsets.UTF_8));
            arrayOutputStream.write("word".getBytes(StandardCharsets.UTF_8));
            date = arrayOutputStream.toByteArray();
        }
        System.out.println(new String(date,"UTF-8"));


    }
}
